Vue.component("myheader",{
    template:
        `
       <div   class="topbar" id="topbar">
        <div class="wrap">
            <ul class="quick-menu frt">
                <li><a rel="nofollow" target="_top" href="./member-order.html">我的订单</a></li>
                <li><span class="line">|</span></li>
                <li><a rel="nofollow" target="_top" href="./member-favorite.html">我的收藏</a></li>
                <li><span class="line">|</span></li>
                <li><a href="./help1.html" target="_blank">帮助中心</a></li>
                <li><span class="line">|</span></li>
                <li class="tel">客服热线：0754-89655102 0754-89655096</li>
            </ul>
            <div class="login flt"><span id="loginBar_576" style="display: block;" class="ie-bug">
                <div v-if="username==null||username==''">
                    <span  class="login-words">您好，<span id="login-name-cookie_576"></span> 欢迎光临持家有道网上超市！</span>
                    <a href="login.htm" class="login-btn" style="color:red">请登录</a><span class="line">|</span>
                    <span><a  href="register.htm" class="signup-btn">注册</a> </span>
                </div>
                <div v-else>
                    <span id="memberBar_576" > 您好&nbsp;<span id="uname_576" v-text="username"></span>
                    <a href="./membe.html">[会员中心]</a><a  href="javascript:void(0);" @click="logout"  >[退出]</a>
                    <span id="con-nm"></span></span>
                </div>
           </span>
            </div>
        </div>
    </div>`,
    data(){
        return{
            username:"",
        }
    },
    created() {
        this.username=window.sessionStorage.getItem("loginUser");
    },
    methods:{
        logout() {
            axios.get("cs-user/logout").then(res => {
                alert("退出成功");
                window.sessionStorage.removeItem('loginUser');
                this.username="";
            })
        }
    }
})